﻿//used 
$(function () {

    //In normal condition, textarea autoresize not working on load, but noticed working fine on window resizing, So by default hide content  
    //and display it after loading
    //******** Imp: spent more than 8 Hrs to fix this issue
    $(".content").show();
    var $container = $('.content');
    $container.imagesLoaded(function () {
        $container.masonry({
            itemSelector: '.qknote',
            columnWidth: 100,
            isFitWidth: true,
            isAnimated: true
        });
    });

    //To fire change event on contenteditable div
    $('body').on('focus', '[contenteditable]', function () {
        var $this = $(this);
        $this.data('before', $this.html());
        return $this;
    }).on('blur keyup paste DOMNodeInserted DOMNodeRemoved', '[contenteditable]', function () {
        var $this = $(this);
        if ($this.data('before') !== $this.html()) {
            $this.data('before', $this.html());
            //$this.trigger('change');

             window.noteApp.noteViewModel.postActions();
        }
        return $this;
    });

});